<template>
  <van-list
    v-model:loading="loading"
    @load="onLoad"
    :finished="finished"
    finished-text="没有更多了"
    :offset="10"
  >
    <van-card
      class="item"
      v-for="item in list"
      :thumb="item.article.picUrl"
      @click="router.push(`/article-detail?articleId=${item.article.id}`)"
    >
      <template #title>
        <p class="title">
          {{ item.article.title }}
        </p>
      </template>
      <template #price>
        <p class="desc">
          {{ item.article.desc }}
        </p> </template
      ><!--  -->
      <template #num>
        <p>{{ item.created_at }}</p>
      </template>
    </van-card>
  </van-list>
</template>

<script setup>
import { praiseList } from "@/api/praise";
import usePageList from "@/hooks/usePageList";
import { useRouter } from "vue-router";

let router = useRouter();
let { loading, finished, onLoad, list } = usePageList(praiseList, {
  type: 2,
  page: 1,
  limit: 10,
});
</script>

<style scoped lang="scss">
.item {
  //   height: 100px;
  //   background-color: antiquewhite;
  margin-bottom: 10px;
}
</style>